#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::paintEvent(QPaintEvent *event)
{
    (void)event;

    QPainter painter(this);
    QPixmap pixmap("F:/tmp/image0.jpeg");
    //基础绘制
    //painter.drawPixmap(100,100,pixmap);//指定坐标
    //painter.drawPixmap(100,100,400,300,pixmap);//指定坐标及宽和高

    //图片旋转,本质是画家旋转
    painter.rotate(180);
    //painter.drawPixmap(100,100,pixmap);//默认旋转原点为0,0,所以图片不可见
    //要将坐标系原点移动才能让图片课件,默认窗口大小是800,600
    painter.translate(-800,-600);
    painter.drawPixmap(100,100,pixmap);
}

